﻿using Newtonsoft.Json;
using System.Collections.Generic;

namespace AutomationCommand
{
    public class wb_data_read : BasiCommand
    {
        [JsonProperty("type")]
        public string Type { get; set; }

        [JsonProperty("path")]
        public string Path { get; set; }

        [JsonProperty("tablename")]
        public string TableName { get; set; }

        [JsonProperty("condition")]
        public string Condition { get; set; }

        [JsonProperty("krv")]
        public List<KRV> KRVList { get; set; }

        [JsonProperty("forwhat")]
        public string ForWhat { get; set; }

        public wb_data_read()
        {
            FunctionType = "wb_data_read";
            OtherName = "读取数据库";
            SuccessJump = -1;
            FailureJump = -1;
            Type = "rnd";
            Path = "";
            TableName = "";
            Condition = "";
            KRVList = new List<KRV>();
            ForWhat = "";
        }

        public  bool Execute()
        {
            // 在这里编写执行命令的逻辑
            // 返回执行结果
            return true; // 假设此处始终成功
        }
    }

    public class KRV
    {
        [JsonProperty("k")]
        public string Key { get; set; }

        [JsonProperty("r")]
        public string Relation { get; set; }

        [JsonProperty("v")]
        public string Value { get; set; }
    }
}
